<?php
class MantenedorPerfiles
{
	
	public function ComboBoxPerfiles($selected)
	{
		echo "<select class='formulario' value='".$selected."' id='ComboBoxPerfiles' name='ComboBoxPerfiles' onclick='cambioSupervisorVenta();' onchange='javascript:seleccionPerfilCB(this.options[this.selectedIndex].value); javascript:ComboBoxSupervisores(document.FormUsuario.ComboBoxEmpresas.options[document.getElementById(\"ComboBoxEmpresas\").selectedIndex].value)'>";
		echo "<option value='0' onclick='cambioSupervisorVenta()'> Perfil </option>";
		require_once("../include/conec.php");
		$link = Conectarse();
		$result = mysql_query("SELECT * FROM perfiles", $link);
		while($row=mysql_fetch_array($result)){			
			echo "<option value='".$row['id']."'";
			if($selected == $row['id'])
				echo " selected";
			/*if($row['id'] == 1)//si id es de ejecutivo
				echo " onclick='javascript:cambioSupervisorVenta(1)'";
			else
				echo " onclick='javascript:cambioSupervisorVenta(0)'";
				
			echo " onclick='javascript:cambioSupervisorVenta()'";*/
			echo ">";
			echo $row['nombre'];
			echo "</option>";
		}
		echo "</select>";
		
		mysql_free_result($result);
		mysql_close($link);
	}
	public function ComboBoxBuscarPerfiles() //funcion para form_usuarios.php
	{
		//echo "<select class='formulario' id='ComboBoxBuscarPerfiles' name='ComboBoxBuscarPerfiles' onchange='BuscarUsuarios(document.getElementById(\"nombre_usuario\").value, document.getElementById(\"apellido_usuario\").value, document.getElementById(\"ComboBoxBuscarEmpresas\").options[document.getElementById(\"ComboBoxBuscarEmpresas\").selectedIndex].value, document.getElementById(\"ComboBoxBuscarPerfiles\").options[document.getElementById(\"ComboBoxBuscarPerfiles\").selectedIndex].value)'>";
		echo "<select class='formulario' id='ComboBoxBuscarPerfiles' name='ComboBoxBuscarPerfiles'>";
		echo "<option value='0'> Perfil </option>";
		require_once("../include/conec.php");
		$link = Conectarse();
		$result = mysql_query("SELECT * FROM perfiles", $link);
	
		while($row=mysql_fetch_array($result)){
				
			echo "<option value='".$row['id']."'>".$row['nombre']."</option>";
		}
		echo "</select>";
		
		mysql_free_result($result);
		mysql_close($link);
	}
	
	
}
?>